#include<bits/stdc++.h>
using namespace std;
int main()
{
    int r[1000000],p[1000000],n,x=0,T;
    cin>>T;
    for(int i = 1;i<=T;i++)
    {
       cin >> n;
       for(int i =0;i<n;i++)
       {
          cin >> r[i];
       }
        for(int i = 0;i<n;i++)
        {
            if(r[i]<=r[i+1])
            {
                p[i]=r[i];
                p[i+1]=r[i+1];
            }
            else
            {
                p[i]=r[i+1];
                p[i+1]=r[i];
            }
                p[i]=r[i+1];
                p[i+1]=r[i];
            }
        }
        for(int i = 0;i<n;i++)
        {
            if(a[i]==a[i+1]||a[i]=a[i+2])
            {
                x+=a[i];
            }
        }
        cout<<sum;
    }
}
